

from flask import Blueprint

from app.libs.forms import LoginForm
from app.service.user import UserService
from app.vo import TokenVO

bp_token = Blueprint('token', __name__, url_prefix='/token')


@bp_token.route('/get', methods=['Post'])
def get():
    form = LoginForm(check_token=False).check_validate()
    user, token = UserService.login(form)
    return TokenVO(
        token=token, msg=f'{user.nickname}(account: {user.account})的token获取成功！').response()
